﻿using System;
using UnityEngine;

namespace DL.SearchAlgorithm
{
    public class test : MonoBehaviour
    {
        //初始化地图，用二维矩阵代表地图，1表示障碍物，0表示可通
        private int[][] _maze = new int[][]
        {
            new int[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
            new int[] { 1, 0__0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1 },
            new int[] { 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1 },
            new int[] { 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1 },
            new int[] { 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1 },
            new int[] { 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1 },
            new int[] { 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0__0, 1 },
            new int[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
        };


        private void Start()
        {
            DfsPos start = new DfsPos(1,1);
            DfsPos end = new DfsPos(6,10);

            Dfs dfs = new Dfs();
            dfs.Init(_maze, _maze.Length, _maze[0].Length, start, end);
            dfs.DfsSearchStart();
            dfs.DisplayAllPath();
        }
    }
}